%M-file for Chapter 2 Application Project: Condition Number

ex = input('Exercise number (3, 4, 5, 7, 9, 10, 11?) ');
       
if ex==3
   e5 = 10^-5;
	e8 = 10^-8;
	e11 = 10^-11;
	format short; 
   A = [1, 1, 1; 2, 3, 4; 3, 4, 5]
   A5 = [1, 1, 1; 2, 3, 4; 3+e5, 4, 5], b5 = [6; 20; 26+e5]
 	A8 = [1, 1, 1; 2, 3, 4; 3+e8, 4, 5], b8=[6; 20; 26+e8]
   A11 = [1, 1, 1; 2, 3, 4; 3+e11, 4, 5], b11=[6; 20; 26+e11] 
elseif ex==4
   format long;
   A5 = [1, 1, 1; 2, 3, 4; 3+10^-5, 4, 5]
   A8 = [1, 1, 1; 2, 3, 4; 3+10^-8, 4, 5]
   A11 = [1, 1, 1; 2, 3, 4; 3+10^-11, 4, 5]
elseif ex==5
   x1 = [-5, 7, 2 -4]'
   x2 = [4, -8, 3, 1]'
   x3 = [7, -9, 1, 0]'
elseif ex==7
   B = [4 -4 3; 7 -4 -5; 7 -7 6]
   C = [2 -4 -9; -3 8 3; 1 7 -5]
   D = [1 0 -4; -6 5 -7; -3 3 -3]
elseif ex==9       
   A5 = [1, 1, 1; 2, 3, 4; 3+10^-5, 4, 5]
   A8 = [1, 1, 1; 2, 3, 4; 3+10^-8, 4, 5]
   A11 = [1, 1, 1; 2, 3, 4; 3+10^-11, 4, 5]
elseif ex==10
   disp('Use help format to answer part d.')
   A=[888445 887112; 887112 885781]
   b=[1; 0]
elseif ex==11
   A = [4 3 2 1; 10 5 3 2; 18 40 45 45; 20 15 12 10]
   B = [9 1 19 7; 2 -4 -9 0; 1 -2 -5 0; 3 2 26 3]
   C = [31 11 21 -9; 54 22 38 -9; -2 -4 -2 -4; 3 1 2 -1]
else
   disp('No data for this exercise for this Application Project.') 
end
   
 